package com.mazaiting.classfile.attr.entity;

import com.mazaiting.classfile.ClassReader;
import com.mazaiting.classfile.constant.ConstantPool;

import java.util.Arrays;

/**
 * 参数注解
 *
 * @author mazaiting
 * @since 2021/8/13
 */
public class ParameterAnnotationsEntity {
    /**
     * 注解数量 无符号 u2
     */
    private final int numAnnotations;
    /**
     * 注解实体属性
     */
    private final AnnotationsEntity[] annotationsEntities;

    public ParameterAnnotationsEntity(ClassReader reader, ConstantPool pool) {
        this.numAnnotations = reader.readU2ToUnsignedShort();
        this.annotationsEntities = new AnnotationsEntity[numAnnotations];
        for (int i = 0; i < numAnnotations; i++) {
            this.annotationsEntities[i] = new AnnotationsEntity(reader, pool);
        }
    }

    @Override
    public String toString() {
        return "ParameterAnnotationsEntity{" +
                "numAnnotations=" + numAnnotations +
                ", annotationsEntities=" + Arrays.toString(annotationsEntities) +
                '}';
    }
}


















